import type { CardListData, GetCardDetail, GetCardListParams, PostParkingCardData, PostParkingCardRes } from "@/types/card"
import { request } from "@/utils/reuqest"



// 查看月卡信息列表
export const GetParkingCardListAPI = (params:GetCardListParams) =>{

  return request<CardListData>('/parking/card/list','GET',params)
} 

// 新增月卡数据
export const PostParkingCardAPI = (data:PostParkingCardData) =>{
  return request<PostParkingCardRes>('/parking/card','POST',data)
}

// 编辑月卡详情
export const GetParkingCardDetailAPI = (id:string) =>{
  return request<GetCardDetail>(`/parking/card/detail/${id}`,'GET')
}

// 编辑月卡
export const PutCardEditAPI = (data:PostParkingCardData) =>{
  return request('/parking/card/edit','PUT',data)
}

// 删除月卡

export const DeleteParkingCardAPI = (ids:number[]) =>{
  // 批量删除时，id用逗号隔开，通过 join 方法拼接字符串
  return request(`/parking/card/${ids.join(',')}`,'DELETE')
}
